package mhl.service;

import mhl.dao.Diningtable;
import mhl.domain.dining;

import java.util.List;

public class DiningTbale {
    Diningtable diningtable=new Diningtable();
    public List<dining> getdiningservice(){
        return diningtable.querymulti("select id,State from diningTable",dining.class);
    }
    public dining getdiningtable(int id){
       return diningtable.querysingle("select * from diningTable where id=?",dining.class,id);
    }
    public boolean getdiningtable1(String orderName,String Tel,int id) {
        int rows =
                diningtable.update("update diningTable set State='已订',orderName=?,Tel=? where id=?", orderName, Tel, id);
        return rows > 0;
    }

    public boolean updateTableState(int id,String state){
        int update= diningtable.update("update diningTable set State=? where id=?",state,id);
        return update>0;
    }

    public boolean updateTableFree(int Id,String state){
        int update = diningtable.update("update diningTable set State=? where id=?", state, Id);
        return update>0;
    }
}
